package com.ddyx.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.ddyx.entity.Employe;
import com.ddyx.mapper.EmployeMapper;
import com.ddyx.service.IImgUploadService;
import com.ddyx.util.QiniuUtil;

import lombok.extern.slf4j.Slf4j;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;

@Slf4j
@Service
public class ImgUploadServiceImpl implements IImgUploadService {
	
	@Resource
	EmployeMapper employeMapper;
	
	@SuppressWarnings("static-access")
	@Override
	public Map<String, String> uploadImg(String wxUid,String wxSid) {
		Map<String, String> map=new HashMap<String, String>();
		
		try {
			String token=new QiniuUtil().getToken();
			if(StringUtils.hasText(token)) {
				map.put("uptoken", token);
				map.put("code", "200");
				return map;
			}
			map.put("code", "405");
		} catch (Exception e) {
			e.printStackTrace();
			log.error("操作有误");
			map.put("code", "400");
		}
		return map;
		
		/*if(StringUtils.hasText(wxUid)) {
			try {
				Example ex=new Example(Employe.class);
				Criteria criteria = ex.createCriteria();
				criteria.andEqualTo("wxUid", wxUid);
				int in=mapper.selectCountByExample(ex);
				if(0<in) {
					String token=new QiniuUtil().getToken();
					if(StringUtils.hasText(token)) {
						map.put("uptoken", token);
						map.put("code", "200");
						return map;
					}
				}
				map.put("code", "405");
			} catch (Exception e) {
				e.printStackTrace();
				log.error("操作有误");
				map.put("code", "400");
			}
		}
		return map;*/
	}
	

}
